package jmine.tec.persist.transaction;

import java.util.concurrent.Callable;


/**
 * Adapta um {@link TransactionalAction} para um Callable
 * 
 * @author takeshi
 * @param <T>
 */
@SuppressWarnings("deprecation")
public final class CallableAdapter<T> implements Callable<T> {

    private final TransactionalAction<T> action;

    /**
     * @param action {@link TransactionalAction}
     */
    public CallableAdapter(TransactionalAction<T> action) {
        this.action = action;
    }

    /**
     * {@inheritDoc}
     */
    public T call() throws Exception {
        return action.execute();
    }
}